package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.app.TabActivity;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TabHost;

//public class MainActivity extends AppCompatActivity {
public class MainActivity extends TabActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TabHost tabHost=getTabHost();
        LayoutInflater.from(this).inflate(R.layout.activity_main,tabHost.getTabContentView(),true);
        LayoutInflater.from(this).inflate(R.layout.section,tabHost.getTabContentView(),true);
        LayoutInflater.from(this).inflate(R.layout.problem,tabHost.getTabContentView(),true);
        tabHost.addTab(tabHost.newTabSpec("TAB1").setIndicator("学习助手").setContent(R.id.tab1));
        tabHost.addTab(tabHost.newTabSpec("TAB2").setIndicator("章节").setContent(R.id.tab2));
        tabHost.addTab(tabHost.newTabSpec("TAB3").setIndicator("题目").setContent(R.id.tab3));
        Button change=findViewById(R.id.change);
        change.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                LinearLayout layout=findViewById(R.id.tab1);
                layout.setBackgroundResource(R.drawable.back);
            }
        });
    }
}